package com.guinea.core.tag;

import java.io.IOException;
import java.util.List;

import javax.servlet.jsp.JspException;

import org.apache.struts.taglib.TagUtils;

import com.guinea.core.utils.CommonUtils;

public class ProvinceTag extends CommonTag {
	public int doEndTag() throws JspException {
		String strAttr = "";
		String code = (String) TagUtils.getInstance().lookup(pageContext, name,
				property, null);

		List provinces = (List) pageContext.getServletContext().getAttribute(
				"provinces");
		strAttr = CommonUtils.provinceCodeToName(code, attr, provinces);

		try {
			pageContext.getOut().print(strAttr);
		} catch (IOException e) {
			e.printStackTrace();
		}

		return super.doEndTag();
	}
}
